package org.smith.docker.sample.service;

import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;

@Service
public class TestService {

    public String test(String a) {

        TestService1.staticMethod("str", -100, Collections.singletonMap("k1", "我是map的值"), Arrays.asList("element1", "element2"), new Object[] {"arr1", "arr2", "arr3"});

        try {
            Thread.sleep(ThreadLocalRandom.current().nextInt(0, 200));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        String randomInt = "-" + ThreadLocalRandom.current().nextInt();

        if (a == null) {
            return "卧槽" + randomInt;
        } else {
            return a + randomInt;
        }
    }
}


class TestService1 {
    public static void staticMethod(String str0, int count, Map m, List l, Object[] os) {
        try {
            Thread.sleep(ThreadLocalRandom.current().nextInt(0, 200));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
